package com.mail.dubbo.handler;

import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.cloud.commons.util.InetUtilsProperties;

import java.net.InetAddress;

public class MyInetUtils extends InetUtils {

    private InetAddress inetAddress = null;

    public MyInetUtils(final InetUtilsProperties properties){
        super(properties);
    }

    @Override
    public InetAddress findFirstNonLoopbackAddress() {
    	//就是这里，把address缓存起来，避免重复执行导致速度慢
        if (inetAddress == null) {
            inetAddress = super.findFirstNonLoopbackAddress();
        }
        return inetAddress;
    }
}